import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/index",
    component: resolve => require(["../views/Home"], resolve),
    children: [
      {
        path: "/index",
        component: resolve => require(["../views/index/Index"], resolve)
      },
      {
        path: "/airRadar",
        component: resolve => require(["../views/airRadar/Index"], resolve)
      },
      {
        path: "/station",
        component: resolve => require(["../views/station/Index"], resolve)
      },
      {
        path: "/psi",
        component: resolve => require(["../views/psi/Index"], resolve)
      },
      {
        path: "/vehicle",
        component: resolve => require(["../views/vehicle/Index"], resolve)
      }
    ]
  },
  {
    path: "/*",
    redirect: "/index"
  }
];

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes
});

export default router;
